#include <stdio.h>

void show(int *target, int size)
{
    for (size_t i = 0; i < size; i++)
    {
        printf("%02d ", target[i]);
    }
    printf("\n");
}

void swap(int &a, int &b)
{
    a = a ^ b;
    b = a ^ b;
    a = a ^ b;
}

int main(int argn, char **argv)
{

    int target[] = {7, 8, 16, 11, 2, 18, 6, 20, 4, 12, 9, 19, 14, 5, 15, 10, 1, 13, 3, 17};
    int size = sizeof(target) / sizeof(int);

    printf("------------------------------------------------------\n");
    show(target, size);
    printf("------------------------------------------------------\n");
    for (int i = 0; i < size; i++)
    {
        for (int j = 0; j < size; j++)
        {
            if (target[i] < target[j])
            {
                swap(target[i], target[j]);
                printf("swap([%02d][%02d],[%02d][%02d]) ", i, target[i], j, target[j]);
                show(target, size);
            }
        }
        printf("------------------------------------------------------\n");
    }
    printf("\nHello World!\n");
    return 0;
}

int main1(int argn, char **argv)
{

    int target[] = {7, 8, 16, 11, 2, 18, 6, 20, 4, 12, 9, 19, 14, 5, 15, 10, 1, 13, 3, 17};
    int size = sizeof(target) / sizeof(int);

    for (int i = 0; i < size; i++)
    {
        for (int j = i + 1; j < size; j++)
        {
            if (target[i] > target[j])
            {
                swap(target[i], target[j]);
                printf("swap([%d][%d],[%d][%d]) ", i, target[i], j, target[j]);
                for (size_t i = 0; i < size; i++)
                {
                    printf("%d ", target[i]);
                }
                printf("\n");
            }
        }
    }

    printf("\nHello World!\n");
    return 0;
}
